# First argument = name in R# Second argument = path to .otf-file#font_add('fa-reg', 'fonts/Font Awesome 6 Free-Regular-400.otf')font_add('fa-brands', 'fonts/Font Awesome 6 Brands-Regular-400.otf')#font_add('fa-solid', 'fonts/Font Awesome 6 Free-Solid-900.otf')
year gnis_id geometry metadata
Length:21560 Min. : 2877 Length:21560 Length:21560
Class :character 1st Qu.: 401309 Class :character Class :character
Mode :character Median :1009494 Mode :character Mode :character
Mean :1070863
3rd Qu.:1530459
Max. :2775865
NA's :2
number_of_records parkname region state
Min. :1 Length:21560 Length:21560 Length:21560
1st Qu.:1 Class :character Class :character Class :character
Median :1 Mode :character Mode :character Mode :character
Mean :1
3rd Qu.:1
Max. :1
unit_code unit_name unit_type visitors
Length:21560 Length:21560 Length:21560 Min. : 0
Class :character Class :character Class :character 1st Qu.: 39125
Mode :character Mode :character Mode :character Median : 155219
Mean : 1277105
3rd Qu.: 608144
Max. :871922828
NA's :4
[1] "Great Smoky Mountains National Park" "Grand Canyon National Park"
[3] "Yosemite National Park" "Rocky Mountain National Park"
[5] "Zion National Park"
Show code
title<-tagList(p('Ranking of popularity of U.S. National Parks'))subtitle<-tagList(span('*by the number of visitors annually*'))caption<-paste0("<span style='font-family:lato;'>**Source**: TidyTuesday Week 38 (2019)</span><br>","<span style='font-family:fa-brands;'></span>","<span style='font-family:lato;'>@mickey.rafa</span>","<span style='font-family:lato;color:white;'>....</span>","<span style='font-family:fa-brands;'></span>","<span style='font-family:lato;color:white;'>.</span>","<span style='font-family:lato;'>mrafa3</span>")
Show code
(df_annual<-df_annual%>%separate(col=unit_name, into =c("parkname_full", "parktype"), sep ="National Park", remove=FALSE))
[1] "Great Smoky Mountains National Park" "Grand Teton National Park"
[3] "Shenandoah National Park" "Acadia National Park"
[5] "Yellowstone National Park"
Show code
title_premodern<-tagList(p('Ranking of popularity of U.S. National Parks (1904-1966)'))
[1] "Golden Gate National Recreation Area"
[2] "Great Smoky Mountains National Park"
[3] "Gateway National Recreation Area"
[4] "Lake Mead National Recreation Area"
[5] "Lincoln Memorial"
[6] "Delaware Water Gap National Recreation Area"
[7] "Gulf Islands National Seashore"
[8] "Chesapeake and Ohio Canal National Historical Park"
[9] "Vietnam Veterans Memorial"
[10] "Grand Canyon National Park"
Show code
df_recent_all_types%>%filter(rank_annual_visitors<=6)%>%ggplot(.,aes(x=year, y=rank_annual_visitors, col=unit_name))+geom_point(shape ='|', stroke =6)+geom_bump(size =1)+geom_text( data =df_recent_all_types%>%filter(year==2010, unit_name%in%highlight_df_recent_all_types),#should string manip the labels to cut out National Park from nameaes(label =unit_name), size =3, hjust =1, nudge_x =-0.1, fontface ='bold')+geom_text( data =df_recent_all_types%>%filter(year==2016, unit_name%in%highlight_df_recent_all_types),aes(label =rank_annual_visitors), hjust =0, nudge_x =1, size =5, fontface ='bold')+annotate('text', x =c(2010, 2016), y =c(0.25, 0.25), label =c('2010', '2016'), hjust =c(0, 1), vjust =1, size =4, fontface ='bold', color =description_color)+scale_y_reverse(position ='right', breaks =seq(20, 2, -2))+#scale_color_manual(values = country_colors) +coord_cartesian(xlim =c(2005, 2020), ylim =c(12, 0), expand =F)+#theme_void() + my.theme+theme(legend.position ='none', panel.grid.major.x =element_blank(), panel.grid.minor.x =element_blank(),#plot.background = element_rect(fill = color_palette[8], color = NA), text =element_text( color =description_color))+labs( title ='Ranking the popularity of U.S. National Parks', subtitle ='by total visitors each decade')
# A tibble: 15 × 8
unit_name state year_opened rank_visitors_2016 visitors
<chr> <chr> <dbl> <int> <dbl>
1 Great Smoky Mountains National… NC 1931 1 11312786
2 Grand Canyon National Park AZ 1919 2 5969811
3 Yosemite National Park CA 1906 3 5028868
4 Rocky Mountain National Park CO 1915 4 4517585
5 Zion National Park UT 1919 5 4295127
6 Yellowstone National Park WY 1904 6 4257177
7 Olympic National Park WA 1935 7 3390221
8 Acadia National Park ME 1919 8 3303393
9 Grand Teton National Park WY 1929 9 3270076
10 Glacier National Park MT 1911 10 2946681
11 Joshua Tree National Park CA 1941 11 2505286
12 Cuyahoga Valley National Park OH 1978 12 2423390
13 Bryce Canyon National Park UT 1929 13 2365110
14 Hawai'i Volcanoes National Park HI 1921 14 1887580
15 Arches National Park UT 1929 15 1585718
# ℹ 3 more variables: percent_change_2006_2016 <dbl>, rank_change_2016 <int>,
# deferred_maintenance <dbl>